/*
 * Copyright 2010 Michael Nitsche
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Lesser General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */

package de.mnit.basis.swt.element;

import org.eclipse.swt.widgets.Dialog;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;

import de.mnit.basis.sys.Ausgabe;

/**
 * @author Michael Nitsche
 *
 * TODO siehe mn.swt.dialog und mn.swt.komp.einfach.dialog
 */
public abstract class A_SWT_Dialog<TA extends A_SWT_Dialog<?,?>, TB extends Dialog> extends A_SWT_Element_Basis<TA,TB> {

	protected Shell gShell() {
		Shell shell=Display.getDefault().getActiveShell();
		if(shell==null) {
			Shell[] shells=Display.getDefault().getShells();
			if(shells.length>0) shell=shells[0];
		}
		if(shell==null) {
			Ausgabe.fehler("Keine Shell für Dialogfenster vorhanden!");
//			Fehler.sonstige.da_Untypisch("Keine Shell vorhanden!");
		}
		return shell;
	}

	protected final int style1() {
		return style2();
	}

	protected final void init1() {
		init2();
	}

	protected abstract int style2();
	protected abstract void init2();

}
